package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.ProjectBean;
import com.project.mapper.IProjectMapper;
import com.project.service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ProjectServiceImpl implements IProjectService {
    @Autowired
    private IProjectMapper mapper;

    @Override
    public void add(ProjectBean project) {
        mapper.add(project);
    }

    @Override
    public ProjectBean findById(Integer prjId) {
        return mapper.findById(prjId);
    }

    @Override
    public PageInfo<ProjectBean> cutByItem(int pageNO, String name, String status, String sort) {
        PageHelper.startPage(pageNO, 3);
        PageInfo pageInfo = PageInfo.of(mapper.findByItem(name, status, sort));
        return pageInfo;
    }

    @Override
    public List<ProjectBean> findUnDeliver() {
        return mapper.findByItem(null,"开发中",null);
    }
}
